<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:s="http://jboss.com/products/seam/taglib"
	template="/WEB-INF/esquema/plantillasimple.xhtml">

	<ui:define name="body">
		<h:form>
			<div align="center">
				<h3>#{messages['operation_permit.activities']}</h3>
				<rich:separator lineType="solid"/>
			</div>
			<br />
			<br />
			<h:panelGroup id="panelActividades">
				<rich:simpleTogglePanel switchType="client" label="#{messages['activities.assignedactivitesheader']}">
					<rich:dataTable value="#{operationPermitHelper.taskInstanceList}" var="tarea" rendered="#{not empty operationPermitHelper.taskInstanceList}">
						<rich:column>
							<f:facet name="header">#{messages['permit.number']}</f:facet>
							<h:outputText value="#{tarea.processInstance.key}"/>
						</rich:column>
						<rich:column>
							<f:facet name="header">#{messages['activities.activity']}</f:facet>
							<h:outputText value="#{resBundle.loadMessage(tarea.name)}"/>
						</rich:column>
						<rich:column>
							<f:facet name="header">#{messages['activities.description']}</f:facet>
							<h:outputText value="#{resBundle.loadMessage(tarea.description)}"/>
						</rich:column>
						<rich:column>
							<f:facet name="header">#{messages['activities.startdate']}</f:facet>
							<h:outputText value="#{tarea.create}">
								<s:convertDateTime type="both" dateStyle="medium"/>
							</h:outputText>
						</rich:column>
						<rich:column>
							<s:link value="#{messages['activities.resume']} >>" action="#{operationPermitHelper.startTask}" taskInstance="#{tarea}"/>
						</rich:column>
					</rich:dataTable>
					<h:outputText value="#{messages['activities.nopending']}" rendered="#{empty operationPermitHelper.taskInstanceList}"/>
				</rich:simpleTogglePanel>
				
				<br/>
				<br/>
				
				<rich:simpleTogglePanel switchType="client" label="#{messages['activities.pooledactivitesheader']}">
					<rich:dataTable id="sidebar_dtactivpendientes" var="tarea"
						value="#{operationPermitHelper.pooledTaskInstanceList}"
						rendered="#{not empty operationPermitHelper.pooledTaskInstanceList}">
						<rich:column>
							<f:facet name="header">#{messages['permit.number']}</f:facet>
							<h:outputText value="#{tarea.processInstance.key}"/>
						</rich:column>
						<rich:column>
							<f:facet name="header">#{messages['activities.activity']}</f:facet>
							<h:outputText value="#{resBundle.loadMessage(tarea.name)}"/>
						</rich:column>
						<rich:column>
							<f:facet name="header">#{messages['activities.description']}</f:facet>
							<h:outputText value="#{resBundle.loadMessage(tarea.description)}"/>
						</rich:column>
						<rich:column>
							<f:facet name="header">#{messages['activities.startdate']}</f:facet>
							<h:outputText value="#{tarea.create}">
								<s:convertDateTime type="both" dateStyle="medium"/>
							</h:outputText>
						</rich:column>
						<rich:column>
							<s:link action="#{pooledTask.assignToCurrentActor}" value="#{messages['activities.claim']}" taskInstance="#{tarea}"/>				
						</rich:column>
					</rich:dataTable>
					<h:outputText value="#{messages['activities.nopending']}" rendered="#{empty operationPermitHelper.pooledTaskInstanceList}"/>
				</rich:simpleTogglePanel>
				<br/>
			</h:panelGroup>
		</h:form>
	</ui:define>
</ui:composition>
